<?php defined('BASEPATH') || exit('No direct script access allowed');

if (! function_exists('building_info_data')) {
    function building_info_data($info, $openTime = '', $passTime = '') {
        if ($openTime) $data[] = (object)['name'=>'开盘时间', 'val'=>$openTime];
        if ($passTime) $data[] = (object)['name'=>'交房时间', 'val'=>$passTime];
        $infoField = ['address'=>'楼盘地址', 'floor_space'=>'占地面积', 'developer_name'=>'开发商', 'lvhua_lv'=>'绿化率', 'chewei_shu'=>'车位数', 'chanquan_n'=>'产权年限', 'zhuangxiu_bz'=>'装修标准', 'wuye_fei'=>'物业费', 'sale_address'=>'售楼处地址', 'all_space'=>'建筑面积', 'rongji_lv'=>'容积率', 'guihua_shu'=>'规划户数', 'chewei_bi'=>'车位比', 'zhuangxiu_qk'=>'装修情况', 'wuye_gs'=>'物业公司'];
        // dump($infoField);
        foreach ($info as $key => $val) {
            if (isset($infoField[$key]) && !empty($val)) {
                if (in_array($key, ['all_space', 'floor_space'])) $val = $val.'平米';
                if (in_array($key, ['wuye_fei'])) $val = $val.'元/平米';
                if ($key == 'chanquan_n') $val = $val == '-1' ? "永久" : $val.'年';
                if ($key == 'lvhua_lv') $val = $val.'%';

                $data[] = (object)['name'=>$infoField[$key], 'val'=>$val];
            }
        }
        return $data;
    }
}
?>